/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class Sellers
    {
    
        private Decimal? totalResultsField;

        private Decimal? totalPagesField;

        private  List<Seller> sellerField;


        /// <summary>
        /// Gets and sets the TotalResults property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalResults")]
        public Decimal TotalResults
        {
            get { return this.totalResultsField.GetValueOrDefault() ; }
            set { this.totalResultsField= value; }
        }



        /// <summary>
        /// Sets the TotalResults property
        /// </summary>
        /// <param name="totalResults">TotalResults property</param>
        /// <returns>this instance</returns>
        public Sellers WithTotalResults(Decimal totalResults)
        {
            this.totalResultsField = totalResults;
            return this;
        }



        /// <summary>
        /// Checks if TotalResults property is set
        /// </summary>
        /// <returns>true if TotalResults property is set</returns>
        public Boolean IsSetTotalResults()
        {
            return  this.totalResultsField != null;

        }


        /// <summary>
        /// Gets and sets the TotalPages property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalPages")]
        public Decimal TotalPages
        {
            get { return this.totalPagesField.GetValueOrDefault() ; }
            set { this.totalPagesField= value; }
        }



        /// <summary>
        /// Sets the TotalPages property
        /// </summary>
        /// <param name="totalPages">TotalPages property</param>
        /// <returns>this instance</returns>
        public Sellers WithTotalPages(Decimal totalPages)
        {
            this.totalPagesField = totalPages;
            return this;
        }



        /// <summary>
        /// Checks if TotalPages property is set
        /// </summary>
        /// <returns>true if TotalPages property is set</returns>
        public Boolean IsSetTotalPages()
        {
            return  this.totalPagesField != null;

        }


        /// <summary>
        /// Gets and sets the Seller property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Seller")]
        public List<Seller> Seller
        {
            get
            {
                if (this.sellerField == null)
                {
                    this.sellerField = new List<Seller>();
                }
                return this.sellerField;
            }
            set { this.sellerField =  value; }
        }



        /// <summary>
        /// Sets the Seller property
        /// </summary>
        /// <param name="list">Seller property</param>
        /// <returns>this instance</returns>
        public Sellers WithSeller(params Seller[] list)
        {
            foreach (Seller item in list)
            {
                Seller.Add(item);
            }
            return this;
        }          
 


        /// <summary>
        /// Checks if Seller property is set
        /// </summary>
        /// <returns>true if Seller property is set</returns>
        public Boolean IsSetSeller()
        {
            return (Seller.Count > 0);
        }




        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetTotalResults()) {
                xml.Append("<TotalResults>");
                xml.Append(this.TotalResults);
                xml.Append("</TotalResults>");
            }
            if (IsSetTotalPages()) {
                xml.Append("<TotalPages>");
                xml.Append(this.TotalPages);
                xml.Append("</TotalPages>");
            }
            List<Seller> sellerList = this.Seller;
            foreach (Seller seller in sellerList) {
                xml.Append("<Seller>");
                xml.Append(seller.ToXMLFragment());
                xml.Append("</Seller>");
            }
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}